<template>
  <div id="Header">
    <div class="main">
      <top></top>
      <div class="title-box">
        <div class="title-box-left"></div>
        <div class="title-box-center">
          <span>xxxxx模型</span>
        </div>
        <div class="title-box-right"></div>
      </div>
      <!-- 使用time，files组件 -->
      <div class="back">
        <div class="zuoyou_click" @click="leftHandler"><</div>
        <div class="back_click">
          <p @click="timesHandler" :class="index==1?'xuzho':''">Time</p>
          <p @click="LocationHandler" :class="index==2?'xuzho':''">Location</p>
          <p @click="filesHandler" :class="index==3?'xuzho':''">Files</p>
          <p @click="reviewsHandler" :class="index==4?'xuzho':''">Review&nbsp;&nbsp;Order</p>
        </div>
        <div class="zuoyou_click" @click="rightHandler">></div>
      </div>
      <div>
        <files v-show="isShow1"></files>
        <times v-show="isShow" @sendToFather="getData"></times>
        <reviews v-show="isShow2"></reviews>
      </div>
    </div>
  </div>
</template>

<script>
import files from "../../components/homeComp/Files.vue";
import times from "../../components/homeComp/Time.vue";
import reviews from "../../components/homeComp/Review.vue";
import { mapState, mapGetters, mapActions } from "vuex";
import top from "../../components/Top/top.vue";
export default {
  components: {
    files,
    times,
    reviews,
    top,
  },
  data() {
    return {
      index:1
    };
  },
  computed: {
    ...mapState({
      count1: (state) => state.count,
    }),
    ...mapGetters(["isShow", "isShow1", "isShow2"]),
  },
  methods: {
    leftHandler(){
      this.index--
      if(this.index <=0){
        this.index=4
      }
      if(this.index === 1){
          this.timesHandler()
      }else if(this.index === 2){
          this.LocationHandler()
      }else if(this.index === 3){
          this.filesHandler()
      }else if(this.index === 4){
          this.reviewsHandler()
      }
    },
    rightHandler(){
      this.index++
      if(this.index>=5){
        this.index=1
      }
       if(this.index === 1){
          this.timesHandler()
      }else if(this.index === 2){
          this.LocationHandler()
      }else if(this.index === 3){
          this.filesHandler()
      }else if(this.index === 4){
          this.reviewsHandler()
      }
    },
    filesHandler() {
      this.$store.commit("hide");
      this.$store.commit("show1");
      // this.fileDisable = true;
      this.$store.commit("hide2");
      this.index = 3
    },
    LocationHandler(){
       this.$store.commit("show");
      this.$store.commit("hide1");
      // this.fileDisable = false;
      this.$store.commit("hide2");
      this.index=2
    },
    timesHandler() {
      this.$store.commit("show");
      this.$store.commit("hide1");
      // this.fileDisable = false;
      this.$store.commit("hide2");
      this.index = 1
    },
    reviewsHandler() {
      this.$store.commit("hide");
      this.$store.commit("hide1");
      this.$store.commit("show2");
      this.index = 4
    },
    getData(evn){
      this.index = evn 
    }
  },

  mounted() {},
};
</script>

<style  scoped lang="scss" >
#Header {
  height: 900px;
  width: 100%;
  .title-box {
    width: 500px;
    height: 100px;
    display: flex;
    position: absolute;
    top: 0;
    left: 50%;
    margin-left: -250px;
    .title-box-left {
      width: 0px;
      height: 0px;
      border: 50px solid #000;
      border-top-color: #496ef0;
      border-bottom-color: transparent;
      border-left-color: transparent;
      border-right-color: #496ef0;
    }
    .title-box-center {
      width: 300px;
      background: #496ef0;
      text-align: center;
      font-size: 35px;
      color: #fff;
      font-weight: 900;
      line-height: 100px;
    }
    .title-box-right {
      width: 0px;
      height: 0px;
      border: 50px solid #000;
      border-top-color: #496ef0;
      border-bottom-color: transparent;
      border-left-color: #496ef0;
      border-right-color: transparent;
    }
  }
  .back {
    width: 100%;
    height: 50px;
    line-height: 50px;
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    margin-bottom: 40px;
    .zuoyou_click {
      width: 50px;
      height: 50px;
      background: #8695a5;
      text-align: center;
      font-size: 32px;
      color: #fff;
      margin: 0 120px;
    }
    .back_click {
      width: 1240px;
      display: flex;
      border-bottom: 2px solid #bcbec0;
      justify-content: center;
      p {
        overflow: hidden;
        height: 47px;
        text-align: center;
        width: 200px;
      }
      .xuzho {
        border-bottom: 4px solid #1c75bc;
      }
    }
  }
}
</style>